package fr.hoteia.appengine.archetype.server.model;

import java.util.Date;

import javax.persistence.Embeddable;

/**
 * <p>
 * <a href="Transactional.java.html"><i>View Source</i></a>
 * </p>
 *
 * @author Denis GOSSET <a href="http://www.hoteia.com"><i>Hoteia.com</i></a>
 * 
 */
@Embeddable
public class Transactional {
	
	/**
	 * Generated serial id
	 */
	private static final long serialVersionUID = -3664408401209090223L;

    protected Date createdDate;

	protected String createdByUserKeyName;

	protected Date lastUpdateDate;
    
	protected String lastUpdateByUserKeyName;

	protected Date deletedAtDate;
    
	protected String deletedByUserKeyName;
    
    protected Boolean deletedObject;

	protected Date hidedAtDate;
    
	protected String hidedByUserKeyName;

    protected Boolean hidedObject;
    
	protected Boolean isDemoObject;

	protected Boolean isValidated;

	protected Boolean isFlagByJob;

	public Transactional() {
	}

	public Date getCreatedDate() {
		return createdDate;
	}

	public void setCreatedDate(Date createdDate) {
		this.createdDate = createdDate;
	}

	public String getCreatedByUserKeyName() {
		return createdByUserKeyName;
	}

	public void setCreatedByUserKeyName(String createdByUserKeyName) {
		this.createdByUserKeyName = createdByUserKeyName;
	}
	
	public Date getLastUpdateDate() {
		return lastUpdateDate;
	}

	public void setLastUpdateDate(Date lastUpdateDate) {
		this.lastUpdateDate = lastUpdateDate;
	}

	public String getLastUpdateByUserKeyName() {
		return lastUpdateByUserKeyName;
	}

	public void setLastUpdateByUserKeyName(String lastUpdateByUserKeyName) {
		this.lastUpdateByUserKeyName = lastUpdateByUserKeyName;
	}
	
	public Date getDeletedAtDate() {
		return deletedAtDate;
	}

	public void setDeletedAtDate(Date deletedAtDate) {
		this.deletedAtDate = deletedAtDate;
	}
	
	public String getDeletedByUserKeyName() {
		return deletedByUserKeyName;
	}

	public void setDeletedByUserKeyName(String deletedByUserKeyName) {
		this.deletedByUserKeyName = deletedByUserKeyName;
	}

	public Boolean getDeletedObject() {
		return deletedObject;
	}

	public void setDeletedObject(Boolean deletedObject) {
		this.deletedObject = deletedObject;
	}

	public Date getHidedAtDate() {
		return hidedAtDate;
	}

	public void setHidedAtDate(Date hidedAtDate) {
		this.hidedAtDate = hidedAtDate;
	}
	
	public String getHidedByUserKeyName() {
		return hidedByUserKeyName;
	}

	public void setHidedByUserKeyName(String hidedByUserKeyName) {
		this.hidedByUserKeyName = hidedByUserKeyName;
	}

	public Boolean getHidedObject() {
		return hidedObject;
	}

	public void setHidedObject(Boolean hidedObject) {
		this.hidedObject = hidedObject;
	}
	
	public Boolean getIsDemoObject() {
		return isDemoObject;
	}

	public void setIsDemoObject(Boolean isDemoObject) {
		this.isDemoObject = isDemoObject;
	}
	
	public Boolean getIsValidated() {
		return isValidated;
	}

	public void setIsValidated(Boolean isValidated) {
		this.isValidated = isValidated;
	}
	
	public Boolean getIsFlagByJob() {
		return isFlagByJob;
	}

	public void setIsFlagByJob(Boolean isFlagByJob) {
		this.isFlagByJob = isFlagByJob;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime
				* result
				+ ((createdByUserKeyName == null) ? 0 : createdByUserKeyName
						.hashCode());
		result = prime * result
				+ ((createdDate == null) ? 0 : createdDate.hashCode());
		result = prime * result
				+ ((deletedAtDate == null) ? 0 : deletedAtDate.hashCode());
		result = prime
				* result
				+ ((deletedByUserKeyName == null) ? 0 : deletedByUserKeyName
						.hashCode());
		result = prime * result
				+ ((deletedObject == null) ? 0 : deletedObject.hashCode());
		result = prime * result
				+ ((hidedAtDate == null) ? 0 : hidedAtDate.hashCode());
		result = prime
				* result
				+ ((hidedByUserKeyName == null) ? 0 : hidedByUserKeyName
						.hashCode());
		result = prime * result
				+ ((hidedObject == null) ? 0 : hidedObject.hashCode());
		result = prime * result
				+ ((isDemoObject == null) ? 0 : isDemoObject.hashCode());
		result = prime * result
				+ ((isFlagByJob == null) ? 0 : isFlagByJob.hashCode());
		result = prime * result
				+ ((isValidated == null) ? 0 : isValidated.hashCode());
		result = prime
				* result
				+ ((lastUpdateByUserKeyName == null) ? 0
						: lastUpdateByUserKeyName.hashCode());
		result = prime * result
				+ ((lastUpdateDate == null) ? 0 : lastUpdateDate.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Transactional other = (Transactional) obj;
		if (createdByUserKeyName == null) {
			if (other.createdByUserKeyName != null)
				return false;
		} else if (!createdByUserKeyName.equals(other.createdByUserKeyName))
			return false;
		if (createdDate == null) {
			if (other.createdDate != null)
				return false;
		} else if (!createdDate.equals(other.createdDate))
			return false;
		if (deletedAtDate == null) {
			if (other.deletedAtDate != null)
				return false;
		} else if (!deletedAtDate.equals(other.deletedAtDate))
			return false;
		if (deletedByUserKeyName == null) {
			if (other.deletedByUserKeyName != null)
				return false;
		} else if (!deletedByUserKeyName.equals(other.deletedByUserKeyName))
			return false;
		if (deletedObject == null) {
			if (other.deletedObject != null)
				return false;
		} else if (!deletedObject.equals(other.deletedObject))
			return false;
		if (hidedAtDate == null) {
			if (other.hidedAtDate != null)
				return false;
		} else if (!hidedAtDate.equals(other.hidedAtDate))
			return false;
		if (hidedByUserKeyName == null) {
			if (other.hidedByUserKeyName != null)
				return false;
		} else if (!hidedByUserKeyName.equals(other.hidedByUserKeyName))
			return false;
		if (hidedObject == null) {
			if (other.hidedObject != null)
				return false;
		} else if (!hidedObject.equals(other.hidedObject))
			return false;
		if (isDemoObject == null) {
			if (other.isDemoObject != null)
				return false;
		} else if (!isDemoObject.equals(other.isDemoObject))
			return false;
		if (isFlagByJob == null) {
			if (other.isFlagByJob != null)
				return false;
		} else if (!isFlagByJob.equals(other.isFlagByJob))
			return false;
		if (isValidated == null) {
			if (other.isValidated != null)
				return false;
		} else if (!isValidated.equals(other.isValidated))
			return false;
		if (lastUpdateByUserKeyName == null) {
			if (other.lastUpdateByUserKeyName != null)
				return false;
		} else if (!lastUpdateByUserKeyName
				.equals(other.lastUpdateByUserKeyName))
			return false;
		if (lastUpdateDate == null) {
			if (other.lastUpdateDate != null)
				return false;
		} else if (!lastUpdateDate.equals(other.lastUpdateDate))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "Transactional [createdByUserKeyName=" + createdByUserKeyName
				+ ", createdDate=" + createdDate + ", deletedAtDate="
				+ deletedAtDate + ", deletedByUserKeyName="
				+ deletedByUserKeyName + ", deletedObject=" + deletedObject
				+ ", hidedAtDate=" + hidedAtDate + ", hidedByUserKeyName="
				+ hidedByUserKeyName + ", hidedObject=" + hidedObject
				+ ", isDemoObject=" + isDemoObject + ", isFlagByJob="
				+ isFlagByJob + ", isValidated=" + isValidated
				+ ", lastUpdateByUserKeyName=" + lastUpdateByUserKeyName
				+ ", lastUpdateDate=" + lastUpdateDate + "]";
	}
}
